package com.example.glide_pre_demo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;
import android.widget.ListView;

import com.example.glide_pre_demo.adapter.ImageAdapter;

/**
 * @author carlos
 * @date 2016/5/15
 */
public class ImageActivity extends Activity {
    private String[] mEatFoodyImages = {
            "http://i.imgur.com/rFLNqWI.jpg",
            "http://i.imgur.com/C9pBVt7.jpg",
            "http://i.imgur.com/rT5vXE1.jpg",
            "http://i.imgur.com/aIy5R2k.jpg",
            "http://i.imgur.com/MoJs9pT.jpg",
            "http://i.imgur.com/S963yEM.jpg",
            "http://i.imgur.com/rLR2cyc.jpg",
            "http://i.imgur.com/SEPdUIx.jpg",
            "http://i.imgur.com/aC9OjaM.jpg",
            "http://i.imgur.com/76Jfv9b.jpg",
            "http://i.imgur.com/fUX7EIB.jpg",
            "http://i.imgur.com/syELajx.jpg",
            "http://i.imgur.com/COzBnru.jpg",
            "http://i.imgur.com/Z3QjilA.jpg",
    };
    private ListView mLv;
    private GridView mGv;
    private ImageAdapter mImageAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_list);
        initView();
        initData();
        initListener();
    }

    private void initView() {
        mLv = (ListView) findViewById(R.id.lv);
        mGv = (GridView) findViewById(R.id.gv);
    }

    private void initData() {
        mImageAdapter = new ImageAdapter(MyApplication.getAppContext(), mEatFoodyImages);
    }

    private void initListener() {
        mLv.setAdapter(mImageAdapter);
        mGv.setAdapter(mImageAdapter);
    }

}
